const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const adminRouter = require('./routes/admin');
const itemRouter = require('./routes/items');
const uploadRouter = require('./routes/uploads');
require('./models/connect');
const app = express();

app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());

app.use('/static', express.static(path.join(__dirname, 'public')));

app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs')


app.use(adminRouter);
app.use(itemRouter);
app.use(uploadRouter)
app.listen(3000, () => {
  console.log('start at port 3000');
})